-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138310: Adds sys.audit event for import_module #138311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sorry for the delay, added a bunch of tests that show some interesting weirdness that (I think) is just the way to import system works, but confirmed things work the way they did before my changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
|
Summary: Backport of upstream PR-138311 which adds sys.audit calls for import_module. python/cpython#138311 Reviewed By: itamaro Differential Revision: D83073937 fbshipit-source-id: 3831c0e8ac424142149f2a92a5d9e7dde49a6440
Adds
sys.audit
toimport_module
.Added updated unit tests.
Cannot populate the
file
argument because it forces loading of the module and breaks LazyLoader, but the typicalimport
statement audit also populates thefile
argument toNone
so this is consistent. The only difference is withimport_module
the audit is called aftersys.modules
is populate, animport
statement will callsys.audit
before it is populate. I don't think this will make a difference, but could be wrong.